cmake_minimum_required(VERSION 3.8)
# set project name
set(PROJECT_NAME yaml-cpp)
project(${PROJECT_NAME} LANGUAGES CXX)
# set cpp version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED FALSE)

if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
	# define _CRT_SECURE_NO_WARNINGS with MSVC
	add_definitions(-D_CRT_SECURE_NO_WARNINGS)
endif()

# add header paths of vendor of YAML_CPP
include_directories(include)

add_definitions(-DYAML_CPP_STATIC_DEFINE)
# find file recurse
	# source files
file(GLOB_RECURSE SOURCE_FILES src/*.cpp)
	# header files
file(GLOB_RECURSE HEADER_FILES src/*.h include/*h)
# set filters of IDE (like VS or XCode)
source_group("Headers" FILES ${HEADER_FILES})
source_group("Sources" FILES ${SOURCE_FILES})

# add executable target with all files used
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES} ${HEADER_FILES})
# set build target (link)
target_link_libraries(${PROJECT_NAME})
